package com.ming.springboot.annotation.autoconfig;

import com.ming.springboot.vo.ManBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by mqsi on 2022/5/11 18:04
 */
@Configuration
@EnableConfigurationProperties(value = ManBeanProperties.class)
public class ManBeanAutoConfiguration {

	@Autowired
	ManBeanProperties manBeanProperties;

	@Bean
	@ConditionalOnMissingBean(ManBean.class)
	public ManBean manBean(){
		ManBean manBean = new ManBean();
		manBean.setManName(manBeanProperties.getManName());
		return manBean;
	}
}
